package com.qf.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaConsumer {

    @KafkaListener(topics = "test",groupId = "test-group1")
    public void con1(ConsumerRecord record){
        int partition = record.partition();
        String topic = record.topic();
        Object value = record.value();
        Object key = record.key();

        System.out.println("分区：" + partition + "==话题:" + topic + "==键:" + key + "==值：" + value);
    }
}
